<%
layout("/layouts/platform.html"){
%>
<%DIRECTIVE DYNAMIC;%>
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-default navbar-btn" href="${base}/platform/train/lumpproduct" data-pjax ><i class="ti-angle-left" id="goback"></i>返回</a>
    </div>
</header>

<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate action="${base}/platform/train/lumpproduct/editDo" method="post">
               	<input id="id" name="id" value="${obj.product.id!}" type="hidden">
               	<input id="createAt" name="createAt" value="${obj.product.createAt!}" type="hidden">
                <div class="row mb10">
                    <div class="col-lg-12">
                   		<div class="form-group">
                            <label for="region_id" class="col-sm-2 control-label">选择片区</label>
							
                            <div class="col-sm-8">
                                <select id="region_id" name="region_id" class="form-control" required="required">
                                	<%for(region in obj.regions){%>
                                		 <option value="${region.id}" <% if(obj.product.region_id==region.id){ %> selected="selected" <% } %>>${region.name}</option>
                                	<%}%>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="project_id" class="col-sm-2 control-label">选择项目</label>
							
                            <div class="col-sm-8">
                                <select id="project_id" name="project_id" class="form-control" required="required">
                                	<%for(project in obj.projects){%>
                                		 <option value="${project.id}" <% if(obj.product.project_id==project.id){ %> selected="selected" <% } %>>${project.name}</option>
                                	<%}%>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">名称</label>

                            <div class="col-sm-8">
                                <input type="text" id="name" class="form-control" name="name" data-parsley-required="true" placeholder="名称" value="${obj.product.name}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="fullname" class="col-sm-2 control-label">全名</label>

                            <div class="col-sm-8">
                                <input type="text" id="fullname" class="form-control" name="fullname" data-parsley-required="true" placeholder="名称" value="${obj.product.fullname}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="code" class="col-sm-2 control-label">编号</label>

                            <div class="col-sm-8">
                                <input type="text" id="code" class="form-control" name="code" data-parsley-required="true" placeholder="编号" value="${obj.product.code}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="train_mode" class="col-sm-2 control-label">培训方式</label>

                            <div class="col-sm-8">
                                 <input type="radio" name="train_mode" data-parsley-required="true" value="1" <% if(obj.product.train_mode =='1'){%>checked="checked"<%}%>  />学时包干
                                 <input type="radio" name="train_mode" data-parsley-required="true" value="0" <% if(obj.product.train_mode =='0'){%>checked="checked"<%}%>  />计时
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="shuttle_mode" class="col-sm-2 control-label">接送方式</label>

                            <div class="col-sm-8">
                                 <input type="radio" name="shuttle_mode" data-parsley-required="true" value="0"  <% if(obj.product.shuttle_mode =='0'){%>checked="checked"<%}%>  />无接送
                                 <input type="radio" name="shuttle_mode" data-parsley-required="true" value="1"  <% if(obj.product.shuttle_mode =='1'){%>checked="checked"<%}%> />班车接送
                                 <input type="radio" name="shuttle_mode" data-parsley-required="true" value="2"  <% if(obj.product.shuttle_mode =='2'){%>checked="checked"<%}%> />定点接送
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="price" class="col-sm-2 control-label">价格</label>
                            
                            <div class="col-sm-8">
                                <input type="text" id="price" class="form-control" name="price" data-parsley-required="true"  placeholder="价格" value="${obj.product.price}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="specs" class="col-sm-2 control-label">产品规格</label>
                            
                            <div class="col-sm-8">
                                <input type="text" id="specs" class="form-control" name="specs" data-parsley-required="true"  placeholder="产品规格"  value="${obj.product.specs}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="payment" class="col-sm-2 control-label">付款说明</label>
                            
                            <div class="col-sm-8">
                                <input type="text" id="payment" class="form-control" name="payment" data-parsley-required="true"  placeholder="付款说明" value="${obj.product.payment}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="remark" class="col-sm-2 control-label">服务说明</label>
                            
                            <div class="col-sm-8">
                                <input type="text" id="remark" class="form-control" name="remark" data-parsley-required="true"  placeholder="服务说明"  value="${obj.product.remark}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="state" class="col-sm-2 control-label">状态</label>

                            <div class="col-sm-8">
                                 <input type="radio" name="state" data-parsley-required="true" value="1"  <% if(obj.product.state ==1){%>checked="checked"<%}%>/>启用
                                 <input type="radio" name="state" data-parsley-required="true" value="0"  <% if(obj.product.state ==0){%>checked="checked"<%}%>/>禁用
                                 <input type="radio" name="state" data-parsley-required="true" value="-1"  <% if(obj.product.state ==-1){%>checked="checked"<%}%>/>已作废
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3"></div>
                <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
                        </div>
                    </div>
                </div>
            </form>
        </section>

    </div>
</div>
<script language="JavaScript">
    $(document).ready(function () {
        $('#addForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    setTimeout(function () {
                        $("#goback").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
</script>

<%}%>
